package core 
{
	import flash.utils.Dictionary;
	import org.airmvc.Controller;
	import utils.T;
	import vo.CastleVO;
	import vo.GeneralVO;
	import vo.PlayerVO;
	import vo.SystemVO;
	
	/**
	 * ...
	 * @author WLDragon 2014-02-28
	 */
	public class CoreC extends Controller 
	{
		
		public function CoreC() 
		{
			super();
		}
		
		override protected function addListeners():void 
		{
			//策略模式指令
			interest(Nws.ST_ALIENATE,alienate);
			interest(Nws.ST_ALLIANCE,alliance);
			interest(Nws.ST_APPOINT,appoint);
			interest(Nws.ST_AWARD_GOLD,awardGold);
			interest(Nws.ST_AWARD_TREASURE,awardTreasure);
			interest(Nws.ST_BUY_EQUIPMENT,buyEquipment);
			interest(Nws.ST_BUY_RICE,buyRice);
			interest(Nws.ST_CONDOLENCES,condolences);
			interest(Nws.ST_CONSCRIPTION,conscription);
			interest(Nws.ST_DEVELOP_AGRICULTURE,developAgriculture);
			interest(Nws.ST_DEVELOP_BUSINESS,developBusiness);
			interest(Nws.ST_DEVELOP_POPULATION,developPopulation);
			interest(Nws.ST_DISASTER_PREVENTION,disasterPrevention);
			interest(Nws.ST_EXPEDITION,expedition);
			interest(Nws.ST_GATHER_INTELLIGENCE,gatherIntelligence);
			interest(Nws.ST_HEAL,heal);
			interest(Nws.ST_MUSTER,muster);
			interest(Nws.ST_PAWN_TREASURES,pawnTreasures);
			interest(Nws.ST_RECONNOITER,reconnoiter);
			interest(Nws.ST_ROPE,rope);
			interest(Nws.ST_SAVE,save);
			interest(Nws.ST_SELL_RICE,sellRice);
			interest(Nws.ST_STUDY,study);
			interest(Nws.ST_TRANSPORT, transport);
			//行军模式指令
			//interest(Nws.MA_ATTACK,attack);
			//interest(Nws.MA_ENCAMP,encamp);
			//interest(Nws.MA_MOVE,move);
			//interest(Nws.MA_RETREAT,retreat);
			//interest(Nws.MA_USE_PLOT, usePlot);
			//短兵相接模式指令
//			interest(Nws.FI_CHOOSE_ACTION,chooseAction);
//			interest(Nws.FI_CHOOSE_FORMATION, chooseFormation);
			//单挑模式指令
			interest(Nws.SO_CAPITULATE,capitulate);
			interest(Nws.SO_CONVINCE,convince);
			interest(Nws.SO_CRIT,crit);
			interest(Nws.SO_FLEE,flee);
			interest(Nws.SO_HIT,hit);
			interest(Nws.SO_IDENTIFY,identify);
			interest(Nws.SO_THUMP,thump);
			interest(Nws.SO_THREATEN, treaten);
			
			//其他逻辑
			interest(Nws.BEGIN_CHOOSE_LEVEL, handleChooseLevel);
			interest(Nws.BEGIN_CHOOSE_MONARCH, handleChooseMonarch);
			interest(Nws.STRATEGY_ACTIVE_CASTLE, handleActiveCastle);
			interest(Nws.CORE_ASK, ask);
		}
		
		private function handleActiveCastle(id:int):void
		{
			Gbl.activeCastle = T.db.getRecord(Cnt.VO_CASTLE,id) as CastleVO;
		}
		
		private function handleChooseMonarch(playerId:int):void
		{
			player = T.db.getRecord(Cnt.VO_PLAYER, playerId) as PlayerVO;
			Gbl.activePlayer = player;
			Gbl.sys.playerID = playerId;
			var d:Dictionary = T.db.getTable(Cnt.VO_PLAYER);
			
			for each(var p:PlayerVO in d)
			{
				if (p.id != playerId)
				{
					npcs.push(p);
				}
			}
			
			ask();
		}
		
		private function handleChooseLevel(level:int):void
		{
			Gbl.sys.level = level;
		}
		
		public function ask():void
		{
			broadcast(Nws.REPORT_PLAY_INCIDENT,0);
			broadcast(Nws.STRATEGY_UNACTIVE_CASTLE);
			broadcast(Nws.STARTUP_GENERAL, false);//隐形武将信息头像
			broadcast(Nws.STRATEGY_REQUEST_CASTLE,1,Gbl.activePlayer.castles);
			var n:String = (T.db.getRecord(Cnt.VO_GENERAL, Gbl.activePlayer.monarchID) as GeneralVO).name;
			Msg.instance.show(n + "大人\n向哪个城池下达命令?",125,330);
		}
		
		override protected function startup(... args):void 
		{
			npcs = [];
			
			Gbl.sys = T.db.getRecord(Cnt.VO_SYSTEM, 1) as SystemVO;
			
		}
		
		/*************** 逻辑区 begin**************************/
		//{策略模式
		/**
		 * 发展农业,generalId,cost
		 */
		public function developAgriculture(args:Array):void
		{
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[0]);
			var cost:Number = args[1];
			var e:int = cost * g.knowledge * 0.001 * (10 + Math.random() * 7);
			
			Gbl.activeCastle.soil += e;//以后要做限制，不能超过999********
			
			if (Gbl.activeCastle.rule < 99)
				Gbl.activeCastle.rule++;
				
			if (e >= 32 && Gbl.activeCastle.rule < 99)
				Gbl.activeCastle.rule++;
				
			if (player == Gbl.activePlayer)
				Msg.instance.show("土地值上升 " + e + "点", 160, 340, 12, ask);
		}
		/**
		 * 发展商业,gid,cost
		 */
		public function developBusiness(args:Array):void
		{
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[0]);
			var cost:Number = args[1];
			var e:int = cost * g.knowledge * 0.001 * (10 + Math.random() * 7);
			Gbl.activeCastle.industry += e;//以后要做限制，不能超过999********
			
			if (Gbl.activeCastle.rule < 99)
				Gbl.activeCastle.rule++;
				
			if (e >= 32 && Gbl.activeCastle.rule < 99)
				Gbl.activeCastle.rule++;
				
			if (player == Gbl.activePlayer)
				Msg.instance.show("商业值上升 " + e + "点", 160, 340, 12, ask);
		}
		
		/**
		 * 发展人口,gid,cost
		 */
		public function developPopulation(args:Array):void
		{
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[0]);
			var cost:Number = args[1];
			var e:int = cost * g.knowledge * 0.05 * (10 + Math.random() * 7);//开发下限为1****
			Gbl.activeCastle.population += e;//以后要做限制，不能超过999900********
			
			if (Gbl.activeCastle.rule < 99)
				Gbl.activeCastle.rule++;
				
			if (e >= 32 && Gbl.activeCastle.rule < 99)
				Gbl.activeCastle.rule++;//开发效果大于32追加统治度
				
			if (player == Gbl.activePlayer)
				Msg.instance.show("人口增加 " + e + "人", 160, 340, 12, ask);
		}
		
		/**
		 * 收集情报,generalId
		 */
		public function gatherIntelligence(args:Array):void
		{
			var gid:int = args[0];
			//收集
			if (player == Gbl.activePlayer)
			{
				var a:Array = Algorithm.find(gid).split('|');
				var t:String = a[0];
				var s:String = a[1];
				broadcast(Nws.INFOMATION_UPDATE_ORDER, 3);
				broadcast(Nws.GENERAL_SHOW_HEAD, gid);
				//结果
				if (t == "5" || t == "6")
				{
					var g:GeneralVO = Algorithm.findGeneral();
					if (g)
					{
						Msg.instance.show(s, 192, 332, 12, dealForGeneral,[g,t]);
					}
					else
					{
						//找到金或米
						if (Math.random() < 0.5)
						{
							a = Algorithm.find(gid, "1").split('|');
						}
						else
						{
							a = Algorithm.find(gid,"2").split('|');
						}
						s = a[1];
						Msg.instance.show(s, 192, 332, 12, ask);
					}
				}
				else
				{
					//找到金米宝或找不到东西
					Msg.instance.show(s, 192, 332, 12, ask);
				}
			}
			else
			{
				//NPC智能
			}
		}
		
		private function dealForGeneral(g:GeneralVO,type:String):void
		{
			var s:String;
			var x:XMLList = T.db.getXml(Cnt.XML_ALGORITHM).special.item.(@id == g.id.toString());
			if (x.length() > 0)
			{
				//特殊
				s = "可是闲谈之中\n此人似乎无意加入我方\n大人是否亲自去劝说？";
				broadcast(Nws.CORE_ADD_GENERAL, g.id, s, -1);
			}
			else
			{
				var gold:int = 0;
				if (type == "5") 
				{
					//找到武将不要钱
					s = "是否收为部下？";
					broadcast(Nws.CORE_ADD_GENERAL, g.id, s, 0);
				}
				else
				{
					//type=="6" 找到武将要钱
					gold = (g.strength + g.power + g.knowledge) / 3;
					s = "该武将索要" + gold + "两金\n是否给予？";
					broadcast(Nws.CORE_ADD_GENERAL, g.id, s, gold);
				}
			}
		}
		
		/**
		 * 同盟
		 */
		public function alliance(args:Array):void
		{
			
		}
		
		/**
		 * 拉拢，castleId,generalId,generalId
		 */
		public function rope(args:Array):void
		{
			var c:CastleVO = T.db.getRecord(Cnt.VO_CASTLE, args[0]);
			var tg:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL,args[1]);//目标武将
			var sg:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[2]);//执行武将
			if (tg.loyalty <= 75)
			{
				var xml:XML = T.db.getXml(Cnt.XML_ALGORITHM).rope[0];
				var x:XML = xml.item.(@minLoy <= tg.loyalty && tg.loyalty <= @maxLoy)[0];
				var a:Number= Number(x.@a);
				var b:Number = Number(x.@b);
				var rate:Number = 0.01 * (sg.knowledge * sg.morality + a + (sg.level - 1) * 100) / b;
				if (Math.random() < rate)
				{
					tg.loyalty = 79 - tg.loyalty;
					var id:String = String(tg.id);
					var i:int = c.genList.indexOf(id);
					c.genList.splice(i, 1);
					Gbl.activeCastle.genList.push(id);
					
					if (player == Gbl.activePlayer)
					{
						broadcast(Nws.INFOMATION_UPDATE_ORDER, 3);
						broadcast(Nws.GENERAL_SHOW_HEAD, sg.id);
						Msg.instance.show("可喜可贺！\n" + tg.name + "已加入麾下", 160, 332, 12, ask);
					}
					return;
				}
			}
			
			if (player == Gbl.activePlayer)
			{
				broadcast(Nws.INFOMATION_UPDATE_ORDER, 3);
				broadcast(Nws.GENERAL_SHOW_HEAD, sg.id);
				Msg.instance.show("惭愧！\n策略未能成功",160,332,12,ask);
			}
		}
		
		/**
		 * 离间，castleId,generalId,generalId
		 */
		public function alienate(args:Array):void
		{
			var tg:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL,args[1]);//目标武将
			var sg:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL,args[2]);//执行武将
			
			var rate:Number = (sg.knowledge + sg.morality) * (98 - tg.loyalty) * 0.0001;
			if (Math.random() < rate)
			{
				var e:int = sg.knowledge / 20 + (Math.random() * 4 >> 0);
				tg.loyalty -= e;
				if (player == Gbl.activePlayer)
				{
					broadcast(Nws.INFOMATION_UPDATE_ORDER, 3);
					broadcast(Nws.GENERAL_SHOW_HEAD, sg.id);
					Msg.instance.show("妙哉！\n"+tg.name+"已对君主产生猜疑",160,332,12,ask);
				}
			}
			else if(player == Gbl.activePlayer)
			{
				broadcast(Nws.INFOMATION_UPDATE_ORDER, 3);
				broadcast(Nws.GENERAL_SHOW_HEAD, sg.id);
				Msg.instance.show("惭愧！\n策略未能成功",160,332,12,ask);
			}
		}
		
		/**
		 * 调动,castleId,[String(gid1),...]
		 */
		public function muster(args:Array):void
		{
			var tc:CastleVO = T.db.getRecord(Cnt.VO_CASTLE, args[0]);
			var gs:Array = args[1];
			musterGenerals(tc, gs);
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("遵命,马上就去",192,332,12,ask);
		}
		
		private function musterGenerals(castle:CastleVO,gIds:Array):void
		{
			var i:int;
			//从源城移出武将，目标城添加武将
			for each(var id:String in gIds)
			{
				i = Gbl.activeCastle.genList.indexOf(id);
				Gbl.activeCastle.genList.splice(i, 1);
				if (int(id) == Gbl.activePlayer.monarchID)
				{
					castle.captainID = int(id);
					castle.genList.unshift(id);
				}
				else
					castle.genList.push(id);
			}
			
			//当目标城池为空城
			if (castle.playerID == 0)
			{
				castle.playerID = Gbl.activePlayer.id;
				Gbl.activePlayer.castles.push(String(castle.id));
				broadcast(Nws.STRATEGY_UPDATE_CASTLE, castle.id, castle.playerID);
			}
			
			if (Gbl.activeCastle.genList.length == 0)
			{
				//当全部武将都移出城
				Gbl.activeCastle.playerID = 0;
				Gbl.activeCastle.captainID = 0;
				i = Gbl.activePlayer.castles.indexOf(String(Gbl.activeCastle.id));
				Gbl.activePlayer.castles.splice(i, 1);
				broadcast(Nws.STRATEGY_UPDATE_CASTLE, Gbl.activeCastle.id, 0);
			}
			else
			{
				//如果移出的武将中有太守则重新安排太守
				if (gIds.indexOf(String(Gbl.activeCastle.captainID)) > -1)
				{
					Gbl.activeCastle.captainID = int(Gbl.activeCastle.genList[0]);
				}
			}
		}
		
		/**
		 * 防灾,gid,cost
		 */
		public function disasterPrevention(args:Array):void
		{
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[0]);
			var cost:Number = args[1];
			var e:int = cost * g.knowledge * 0.001 * (6 + Math.random() * 4);
			
			Gbl.activeCastle.disater += e;//以后要做限制，不能超过99********
				
			if (player == Gbl.activePlayer)
				Msg.instance.show("防灾值上升 " + e + "点", 160, 340, 12, ask);
		}
		
		/**
		 * 出征,castleId,[String(gId),...],[gold,rice],gId
		 */
		public function expedition(args:Array):void
		{
			var c:CastleVO = T.db.getRecord(Cnt.VO_CASTLE, args[0]);
			var gold:int = args[2][0];
			var rice:int = args[2][1];
			Gbl.activeCastle.gold -= gold;
			Gbl.activeCastle.rice -= rice;
			
			if (c.playerID == 0)
			{
				//空城
				musterGenerals(c, args[1]);
				c.gold += gold;
				c.rice += rice;
				c.captainID = args[3];
				
				if (player == Gbl.activePlayer)
					Msg.instance.show("势必攻下该城",192,332,12,ask);
			}
			else
			{
				var mG:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[3]);
				var gs:Array = [];
				gs.push(mG);
				for each(var gid:String in args[1])
				{
					//从源城移出武将
					var i:int = Gbl.activeCastle.genList.indexOf(gid);
					Gbl.activeCastle.genList.splice(i, 1);
					//将id转为VO类
					var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, int(gid));
					if(g != mG)
						gs.push(g);
				}
				
				//当全部武将都移出城
				if (Gbl.activeCastle.genList.length == 0)
				{
					Gbl.activeCastle.playerID = 0;
					Gbl.activeCastle.captainID = 0;
					i = Gbl.activePlayer.castles.indexOf(String(Gbl.activeCastle.id));
					Gbl.activePlayer.castles.splice(i, 1);
					broadcast(Nws.STRATEGY_UPDATE_CASTLE, Gbl.activeCastle.id, 0);
				}
				else
				{
					Gbl.activeCastle.captainID = int(Gbl.activeCastle.genList[0]);
				}
				
				broadcast(Nws.MENU_SHOW_OR_HIDE, false);
				broadcast(Nws.STARTUP_MARCH, Nws.STARTUP_MARCH, c, gs, gold, rice, mG);
			}
			
			broadcast(Nws.REPORT_PLAY_INCIDENT,0);
		}
		
		/**
		 * 征兵,[soliderNumber]
		 */
		public function conscription(args:Array):void
		{
			var n:int = args[0][0];
			Gbl.activeCastle.reservist += n;
			Gbl.activeCastle.gold -= n * 0.2;
			
			if (Gbl.activePlayer == player)
			{
				broadcast(Nws.MENU_SHOW_OR_HIDE, false);
				broadcast(Nws.CORE_CONSCRIPTION);
			}
		}
		
		/**
		 * 任命太守,gid
		 */
		public function appoint(args:Array):void
		{
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[0]);
			var i:int = Gbl.activeCastle.genList.indexOf(String(g.id));
			Gbl.activeCastle.genList.splice(i, 1);
			Gbl.activeCastle.genList.unshift(String(g.id));
			Gbl.activeCastle.captainID = g.id;
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("任命"+g.name+"为太守", 160, 340, 12, ask);
		}
		
		/**
		 * 运输物资,castleId,[gold,rice,treasure]
		 */
		public function transport(args:Array):void
		{
			var c:CastleVO = T.db.getRecord(Cnt.VO_CASTLE, args[0]);
			var gold:int = args[1][0];
			var rice:int = args[1][1];
			var trea:int = args[1][2];
			
			Gbl.activeCastle.gold -= gold;
			Gbl.activeCastle.rice -= rice;
			Gbl.activeCastle.treasure -= trea;
			c.gold += gold;
			c.rice += rice;
			c.treasure += trea;
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("遵命，马上就去", 160, 340, 12, ask);
		}
		
		/**
		 * 用金赏赐武将,[gold],gid
		 */
		public function awardGold(args:Array):void
		{
			var gold:int = args[0][0];
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL,args[1]);
			var m:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, Gbl.activePlayer.monarchID);
			var e:int = (m.morality * 0.1 + gold * 0.05) * (7 + Math.random() * 3) * 0.1;
			g.loyalty += e;
			Gbl.activeCastle.gold -= gold;
			
			if (player == Gbl.activePlayer)
			{
				broadcast(Nws.GENERAL_SHOW_HEAD, g.id);
				broadcast(Nws.INFOMATION_UPDATE_ORDER, 3);
				Msg.instance.show("武将忠诚度上升 "+e+"点", 160, 340, 12, ask);
			}
		}
		
		/**
		 * 用宝赏赐武将,gid
		 */
		public function awardTreasure(args:Array):void
		{
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL,args[0]);
			var m:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, Gbl.activePlayer.monarchID);
			var e:int = (m.morality * 0.1 + 3) * (10 + Math.random() * 6) * 0.1;
			g.loyalty += e;
			Gbl.activeCastle.treasure--;
			
			if (player == Gbl.activePlayer)
			{
				broadcast(Nws.GENERAL_SHOW_HEAD, g.id);
				broadcast(Nws.INFOMATION_UPDATE_ORDER, 3);
				Msg.instance.show("武将忠诚度上升 "+e+"点", 160, 340, 12, ask);
			}
		}
		
		/**
		 * 慰问群众,[gold,rice]
		 */
		public function condolences(args:Array):void
		{
			var gold:int = args[0][0];
			var rice:int = args[0][1];
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, Gbl.activeCastle.captainID);
			var e:int = (rice + gold) * g.morality * 0.00005 * (10 + Math.random() * 6);
			Gbl.activeCastle.gold -= gold;
			Gbl.activeCastle.rice -= rice;
			Gbl.activeCastle.rule += e;
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("民众非常高兴\n统治度上升 " + e + "度", 140, 332, 12, ask);
		}
		
		/**
		 * 购买装备,generalId,equipId
		 */
		public function buyEquipment(args:Array):void
		{
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[0]);
			var eId:int = args[1];
			if (eId < 25)
			{
				g.weaponID = eId;//武器
			}
			else
			{
				g.armorID = eId;//防具
			}
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("已买入新武器\n将旧物交与部下",160,332,12,ask);
		}
		
		/**
		 * 医疗,generalId,cost
		 */
		public function heal(args:Array):void
		{
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[0]);
			var cost:int = args[1];
			var e:int = 35 + Math.random() * 10;
			var d:int = g.strengthUp - g.strength;
			e = e > d?d:e;
			g.strength += e;
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("武将体力恢复 " + e + "点", 160, 330, 12, ask);
		}
		
		/**
		 * 买米,[rice]
		 */
		public function buyRice(args:Array):void
		{
			var rice:int = args[0][0];
			var x:XML = T.db.getXml(Cnt.XML_CASTLE).castle.(@id==Gbl.activeCastle.id)[0];
			var r:Number = Number(x.@buy);
			Gbl.activeCastle.rice += rice;
			Gbl.activeCastle.gold -= rice / r * 100;
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("增加 "+rice+"石米", 160, 332, 12, ask);
		}
		
		/**
		 * 卖米,[rice]
		 */
		public function sellRice(args:Array):void
		{
			var rice:int = args[0][0];
			var x:XML = T.db.getXml(Cnt.XML_CASTLE).castle.(@id==Gbl.activeCastle.id)[0];
			var r:Number = Number(x.@sell);
			var gold:int = rice * r / 100;
			Gbl.activeCastle.rice -= rice;
			Gbl.activeCastle.gold += gold;
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("收入 "+gold+"两金", 160, 332, 12, ask);
		}
		
		/**
		 * 当宝（宝换金）,[treasure]
		 */
		public function pawnTreasures(args:Array):void
		{
			var t:int = args[0][0];
			Gbl.activeCastle.treasure -= t;
			Gbl.activeCastle.gold += 100 * t;
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("收入 "+ (100 * t) +"两金", 160, 332, 12, ask);
		}
		
		/**
		 * 读书,gid,cost
		 */
		public function study(args:Array):void
		{
			var g:GeneralVO = T.db.getRecord(Cnt.VO_GENERAL, args[0]);
			var cost:int = args[1];
			var xml:XML = T.db.getXml(Cnt.XML_ALGORITHM).enquire.item.(@id == "5302")[0];
			var x:XML = xml.cost.(@minKno <= g.knowledge && g.knowledge <= @maxKno)[0];
			var a:Array = String(x.@effects).split(',');
			var e:int = a[(Math.random() * a.length >> 0)];
			g.knowledge += e;
			
			if (player == Gbl.activePlayer)
				Msg.instance.show("武将智力上升 " + e + "点", 160, 330, 12, ask);
		}
		
		/**
		 * 保存（写入史册）
		 */
		public function save(args:Array):void
		{
			T.db.save();
			var sys:SystemVO = T.db.getRecord(Cnt.VO_SYSTEM, 1);
			var s:String = "至"+ sys.year + "年" + sys.month + "月之历史\n已被记入史册";
			Msg.instance.show(s,160,332,12,ask);
		}
		
		/**
		 * 侦察
		 */
		public function reconnoiter(args:Array = null):void
		{
			broadcast(Nws.INFOMATION_SWITCH_CITY, 0);
			broadcast(Nws.STRATEGY_REQUEST_CASTLE, 3, Cnt.ALL_CASTLE);
			Msg.instance.show("侦察哪座城池?", 160, 340);
		}
		//}
		
		//{行军模式
		/**
		 * 攻击
		 */
		public function attack(args:Array):void
		{
			
		}
		
		/**
		 * 移动
		 */
		public function move(args:Array):void
		{
			
		}
		
		/**
		 * 使用计谋
		 */
		public function usePlot(args:Array):void
		{
			
		}
		
		/**
		 * 扎营
		 */
		public function encamp(args:Array):void
		{
			
		}
		
		/**
		 * 撤退
		 */
		public function retreat(args:Array):void
		{
			
		}
		//}
		
		//{短兵相接
		/**
		 * 选择阵型
		 */
		public function chooseFormation():void
		{
			
		}
		
		/**
		 * 选择作战行为
		 * 参数为武将和士兵的前进,后退,包围,待机及武将使用技能
		 */
		public function chooseAction():void
		{
			
		}
		//}
		
		//{单挑模式
		/**
		 * 挑逗(轻击)
		 */
		public function hit(args:Array):void
		{
			
		}
		
		/**
		 * 攻击(重击)
		 */
		public function thump(args:Array):void
		{
			
		}
		
		/**
		 * 暴击
		 */
		public function crit(args:Array):void
		{
			
		}
		
		/**
		 * 说服
		 */
		public function convince(args:Array):void
		{
			
		}
		
		/**
		 * 恫吓
		 */
		public function treaten(args:Array):void
		{
			
		}
		
		/**
		 * 逃跑
		 */
		public function flee(args:Array):void
		{
			
		}
		
		/**
		 * 投降
		 */
		public function capitulate(args:Array):void
		{
			
		}
		
		/**
		 * 互报身份
		 */
		public function identify(args:Array):void
		{
			
		}
		//}
		
		/**玩家*/
		private var player:PlayerVO;
		/**NPC玩家<PlayerVO>*/
		private var npcs:Array;
		
		static public const EX:String = "ex";
	}
	
}